package user_mapping

import (
	"context"

	commonTools "algo-sdk-go/common/tools"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/logic/user_profile"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/svc"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type RecommendUserprofileLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRecommendUserprofileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecommendUserprofileLogic {
	return &RecommendUserprofileLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RecommendUserprofileLogic) RecommendUserprofile(req *types.RecommendUserprofileRequest) (resp *types.RecommendUserprofileResponse, err error) {
	resp = &types.RecommendUserprofileResponse{}

	recommend, err := l.svcCtx.MatchService.Recommend(l.ctx)
	if err != nil {
		return nil, err
	}

	resp.Data.RecommendList = commonTools.Cast(recommend, user_profile.CastUserProfile)
	return
}
